package Object_01;

/*
 *类执行顺序
 **/
public class Z extends X {
    public Z() {
        System.out.println("Z构造方法");
    }

    {
        System.out.println("z代码块");
    }

    Y y = new Y();

    static {
        System.out.println("Z静态代码块");
    }

    public static void main(String[] args) {
        new Z();
    }
}

class X {
    public X() {
        System.out.println("x构造方法");
    }

    Y y = new Y();

    static {
        System.out.println("X静态代码块");
    }

}

class Y {
    static {
        System.out.println("Y静态代码块");
    }

    public Y() {
        System.out.println("y构造方法");
    }
}

